/**
 * 
 */
package com.edocbase.desktop.plugins.mdairy.part;

import com.edocbase.desktop.lightweight.widgets.IItemBodyLazyLoadProxy;
import com.edocbase.desktop.lightweight.widgets.ITabFolderListener;
import com.edocbase.desktop.lightweight.widgets.TabFolder;
import com.edocbase.desktop.lightweight.widgets.TabItem;

/**
 * @author lifei114@gmail.com
 * 
 */
public abstract class AbstractTabWorkPart extends AbstractWorkPart implements
		IItemBodyLazyLoadProxy, ITabFolderListener {

	protected TabFolder folder;

//	protected TabItem newTabItem(String title, int style) {
//		TabFolder folder = viewer.getWorkBody();
//		TabItem tabItem = new TabItem(folder, SWT.NONE | SWT.CLOSE);
//		tabItem.setText(title);
//		tabItem.setBodyLoadProxy(this);
//		folder.addItem(tabItem);
//		folder.selectTab(tabItem);
//		return tabItem;
//	}
	@Override
	protected void createPart() {
		folder = viewer.getWorkBody();
		folder.addFolderListener(this);
	}
	@Override
	public void activeTab(TabItem item) {
		
	}

	@Override
	public void deactiveTab(TabItem item) {
		
	}

	@Override
	public boolean closeBefore(TabItem tabItem) {
		doDispose(tabItem);
		tabItem.setBodyLoadProxy(null);
		return true;
	}
	@Override
	public void closeTab(TabItem item) {
	
	}

	protected void doDispose(TabItem item){
		
	}
}
